package com.yvon.service.demo.jdk.extend;

/**
 * @author : Yvon
 * @since : 2021-10-14
 */
public class Chrild extends Parent {
    int grade;
    public Chrild() {
        System.out.println("子类无参构造函数");
    }

    public Chrild(String name, int age, int grade) {
        super(name, age);
        this.grade = grade;
        System.out.println("子类有参构造函数");
    }

    static {
        System.out.println("子类静态代码块");
    }

    Person person = new Person();

    {
        System.out.println("子类非静态代码块");
    }

    public void print() {
        System.out.println("子类普通方法");
    }

    public static void main(String[] args) {
        new Chrild().print();
        System.out.println("---------------");
        new Chrild("王",12,1).print();
    }
}
